package com.dubbo.util;

import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;

public class SSHUtil {
    public  static void initDB(String zookeeperHost,int port)  {
        Session session = null;
        try {
            JSch jsch = new JSch();
             session = jsch.getSession("devlop", "192.168.2.57", 22);
            session.setPassword("devlop");
            java.util.Properties config = new java.util.Properties();
            config.put("StrictHostKeyChecking", "no");
            //config.put("Compression", "yes");
            //config.put("ConnectionAttempts", "2");
            session.setConfig(config);
            // Connect
            session.connect();
            session.setPortForwardingL(2180, zookeeperHost, port);
        }catch (Exception e){
            e.printStackTrace();
            session.disconnect();
        }
    }

}
